-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman unshare keep exit code #11513
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is how it should handle these errors: (The same way podman run and podman exec do.) podman unshare --bogus |
test/e2e/unshare_test.go
Outdated
@@ -47,8 +47,7 @@ var _ = Describe("Podman unshare", func() { | |||
session := podmanTest.Podman([]string{"unshare", "readlink", "/proc/self/ns/user"}) | |||
session.WaitWithDefaultTimeout() | |||
Expect(session).Should(Exit(0)) | |||
ok, _ := session.GrepString(userNS) | |||
Expect(ok).To(BeFalse()) | |||
Expect(session.OutputToString()).To(ContainSubstring(userNS)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this should be Not()
?
@rhatdan Thanks, I didn't know ENOENT and EPERM get special exit codes. This is how it looks now: $ bin/podman unshare --bogus
Error: unknown flag: --bogus
125
$ bin/podman unshare /usr/bin/bogus
Error: fork/exec /usr/bin/bogus: no such file or directory
127
$ bin/podman unshare bogus
Error: exec: "bogus": executable file not found in $PATH
127
$ bin/podman unshare /etc
Error: fork/exec /etc: permission denied
126
$ bin/podman unshare bash -c "exit 52"
52 |
7c85305
to
fd318f5
Compare
Test failures are because of #11521 |
Good to rebase, now that that is fixed? |
LGTM |
In case the command inside the podman unshare env failed podman unshare always exits with 125 and prints `Error: exit status 125`. This is a bad user experience and makes it difficult to use in scripts which could expect certain exit codes. This commit makes sure podman unshare uses the same exit code as the command and does not print the useless `exit status X` message. Also to match podman run/exec it should return 126 for EPERM and 127 for ENOENT. Signed-off-by: Paul Holzinger <[email protected]>
/lgtm |
LGTM |
In case the command inside the podman unshare env failed podman unshare
always exits with 125 and prints
Error: exit status 125
. This is abad user experience and makes it difficult to use in scripts which could
expect certain exit codes.
This commit makes sure podman unshare uses the same exit code as the
command and does not print the useless
exit status X
message.